package model_share

import (
	model_base "hft/Internal/Model/base"
	model_utils "hft/Internal/Model/utils"
)

// 请求类型
const (
	POST   = "POST"
	GET    = "GET"
	PUT    = "PUT"
	DELETE = "DELETE"
)

// api表
type Api struct {
	model_base.IDColumn
	Type   string `json:"type" gorm:"type:varchar(10);size:10;not null;comment:请求类型" validate:"required,oneof=POST GET PUT DELETE"`
	Path   string `json:"path" gorm:"type:varchar(100);size:100;not null;comment:请求路径" validate:"ocPath"`
	RuleID uint   `json:"-" gorm:"not null;comment:对应的规则ID"`
}

func (e Api) TableName() string {
	return model_utils.Name(e)
}
